import api from '../../utils/fetch.js';
const {fetch} = api;
Page({
  data:{
    bannerlist:[],
    gridlist:[],
    title:'沧州宝'
  },
  onLoad(){
    this.initapi()
  },
  // 初始化获取数据，这个只是测试promise.all的使用
  initapi(){
    let banner = fetch('slides');
    let grid = fetch('categories');
    const pall = Promise.all([banner, grid]);
    pall.then(([b,g]) => {
      // console.log(b,g)
      this.setData({
        bannerlist: b.data,
        gridlist: g.data
      })
    })
  }
})